<%--
 *  File:    CountyAreaEdit.jsp
 *  @Author: JackYin 
 *  Date:    2011/1/12
 *
 *  Copyright (C) 2000 - 2010 Oval Technologies, Inc.
 *  All rights reserved. 
 *
 *  This software is the confidential and proprietary information of Oval 
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>


<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java" %>     
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>
<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>
<%@ taglib uri="/WEB-INF/oval-tag.tld" prefix="oval" %>

<%
  //init param
  Category cat = Category.getInstance("jsp.CountyAreaEdit");
  String strModuleName = "ERM";
  String privilegeCode = "10330";
  String contextPath = request.getContextPath();
%>
<% //--------------------  include files list --%>
<%@ include file="/inc/Security.inc" %>
<%@ include file="/inc/PageDefault.inc" %>
<%@ include file="/inc/LocationDefault.inc" %>
<html>
<head>
<title>HospitalEdit</title>
<PageFlow:CheckPageFlow pageName="p_countyareadetail"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="<%=contextPath %>/css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="<%=contextPath %>/js/ScriptLib.js"></script>
<script language="JavaScript">
function page_done()
{ 
	//alert(document.getElementsByTagName("html")[0].innerHTML);
	
  if(!checkForm(document.cform))
    return;
  document.cform.target = "_self";
  var orgid=document.cform.orgid.value;
  if(orgid==null || orgid==""){
	  document.cform.actionname.value="add";
  }else{
	  document.cform.actionname.value="modify";
	  }
  //__submitData(countyareaformid);
  isRunning = true;
  document.cform.submit();
}


var popwindow;

function page_setRegion(code,name)
{
  if(code != document.cform.regioncode.value)
  {
    document.cform.citycode.value = " ";
    document.cform.cityname.value = " ";
  }
  document.cform.regioncode.value = code;
  document.cform.regionname.value = name;
  if (popwindow != null)
    popwindow.close();
}

function page_selectProvince()
{
  if(popwindow!=null)
    popwindow.close();
  popwindow = window.open('<%=contextPath %>/masterdata/ogm/RegionSelect.jsp?<%= OvalTools.randomURL() %>&languagecode=<%= strLanguageCode %>&countrycode=CN','newwindow', 'height=250, width=500,top=100,left=100,toolbar=n0, menubar=no, scrollbars=no, resizable=no, location=no, status=no');
}

 function page_selectCity(flag,grade)
 {
   var regioncode = document.cform.regioncode.value;
   var parentcitycode = document.cform.citycode.value;
   if(flag=="city")parentcitycode='null';
   if(regioncode=="" || regioncode==-1)
   {
     alert("<%= message.getMessageDesc("MUST_SELECT_FIRST",label.getLabelName("L_Province"))%>");
     return;
     if(parentcitycode=="" || parentcitycode==-1)
   {
     alert("<%= message.getMessageDesc("MUST_SELECT_FIRST",label.getLabelName("L_City"))%>");
     return;
   }
   }
   
   if(popwindow!=null)
     popwindow.close();
   popwindow = window.open('<%=contextPath %>/masterdata/ogm/CitySelect.jsp?<%= OvalTools.randomURL() %>&languagecode=<%= strLanguageCode %>&countrycode=CN&regioncode=' + regioncode + '&flag=' + flag+'&grade='+grade+'&parentcitycode='+parentcitycode,'newwindow', 'height=250, width=400,top=100,left=100,toolbar=n0, menubar=no, scrollbars=yes, resizable=no, location=no, status=no');
 }
 

 function page_setCity(code,name,id,flag)
 {
 	if(flag == "county"){
 		document.cform.countycode.value = code;
 		document.cform.countyname.value = name;
 	}else {
 		document.cform.citycode.value = code;
 		document.cform.cityname.value = name;
 		document.cform.countycode.value = " ";
     	document.cform.countyname.value = " ";
 	}
   if (popwindow != null)
     popwindow.close();
 }


function page_setOrg(id,name,code)
{
  document.cform.parentorgid.value = id;
  document.cform.parentorgcode.value = code;  
  document.cform.parentorgname.value = name;
  var remote = window.open("","newwindow");
  if (remote != null)
    remote.close();
    alert(document.cform.parentorgname.value);
}

function page_back(){
	self.location.href='CountyAreaSummary.jsp?<%= OvalTools.randomURL()%>&summaryidentify=countyarea';
}

function page_showExtendInfo(){
	document.getElementById("extendinfo").style.display="block";
	document.getElementById("showbutton").style.display="none";
	document.getElementById("hiddenbutton").style.display="block";
}

function page_hiddenExtendInfo(){
	document.getElementById("showbutton").style.display="block";
	document.getElementById("extendinfo").style.display="none";
	document.getElementById("hiddenbutton").style.display="none";
}
</script>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" cellspacing="0" cellpadding="0">
  <tr>
    <td class="summary_top"></td>
  </tr>
</table>
<table width="100%" cellspacing="0" cellpadding="0" >
<form  name="cform" method="post" action="<%=contextPath %>/Dispatcher" target="_self">
<input type="hidden" name="pagename" value="p_countyareadetail">
<custom:hidden property="detailactionname" changedName="actionname"/>
<custom:hidden property="detailactionname"/>
<custom:hidden property="orgid" name="countyareadetail"/>
<custom:hidden property="infoid" name="countyareadetail"/>
<%
	boolean codereadonly = false;
	if(pageContext.getAttribute("countyareadetail") != null ){
		codereadonly = true;
	}
%>
  <tr> 
    <td valign="top"> 
        <table border="1" cellspacing="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" align="center" width="100%" cellpadding="1">
          <tr> 
            <td colspan="4" class="deepblue-left"><img src="<%=contextPath %>/images/<%= strLanguageCode %>/quote.gif"> 
              	<%= label.getLabelName("L_BasicInfo") + label.getLabelName("L_Colon") %></td>
          </tr>
          <tr> 
            <td class="need" width="20%"><%=label.getLabelName("L_CountyregionalCode") + label.getLabelName("L_Colon") %></td>
            <td width="30%"><custom:text property="countyareacode" name="countyareadetail" command="notnull" label="L_CountyregionalCode" readonly="<%=codereadonly %>"/></td>
            <td class="td-text" width="20%"><%= label.getLabelName("L_InfoDeptReferenceNo") + label.getLabelName("L_Colon") %></td>
            <td width="30%"><custom:text property="referenceorgcode" name="countyareadetail" label="L_InfoDeptReferenceNo"/></td>
          </tr>
          <tr>
            <td class="need" ><%= label.getLabelName("L_CountyregionalName") + label.getLabelName("L_Colon") %></td>
            <td><custom:text property="countyareaname" name="countyareadetail" command="notnull" label="L_CountyregionalName"/></td>
            <td class="need"><%= label.getLabelName("L_CountyregionalShortName") + label.getLabelName("L_Colon") %></td>
            <td><custom:text property="shortname" name="countyareadetail" command="notnull" label="L_CountyregionalShortName"/></td>
          </tr>
          <tr>
          <td class="need"><%= label.getLabelName("L_SCMRole") + label.getLabelName("L_Colon") %></td>
            <td><custom:selectdic dictType="GlobalPCCode" property="globalpccode" name="countyareadetail"  command="notnull" label="L_SCMRole" defaultValue="---------" defaultValueCost="" /></td>
          <!--
          	<td class="td-text" ><%= label.getLabelName("L_ParentOrgShortName") + label.getLabelName("L_Colon") %></td>
            <td>
            	 <custom:text property="parentorgcode" name="hospitaldetail" readonly="true" size="10"></custom:text>
            	<a onclick="popup('<%=contextPath %>/masterdata/ogm/OrgSelect.jsp?<%= OvalTools.randomURL() %>','newwindow','height=250, width=600,top=100,left=100,toolbar=n0, menubar=no, scrollbars=yes, resizable=no, location=no, status=no')"><custom:button type="3" label="L_Asterisk" imgsrc="flash.gif" border="0"/></a>
            	<custom:text property="parentorgname" name="hospitaldetail" readonly="true" size="20"></custom:text>
            </td>
            <custom:hidden property="parentorgid" name="hospitaldetail"></custom:hidden>
            -->
            
            <td class="need"><%= label.getLabelName("L_Province") + label.getLabelName("L_Colon") %></td>
            <td> 
            	<custom:text property="regioncode" name="countyareadetail" command="notnull" label="L_Province" size="10" readonly="true"/>
            	<a onclick="javascript:page_selectProvince();"><custom:button type="3" label="L_Asterisk" imgsrc="flash.gif" border="0"/></a>
            	<custom:text property="regionname" name="countyareadetail" readonly="true" size="20"/>
            </td>
          </tr>
          <tr>
          	<td class="need"><%= label.getLabelName("L_City") + label.getLabelName("L_Colon") %></td>
          	<td>
          		<custom:text property="citycode" name="countyareadetail" size="10" readonly="true"/>
            	<a onclick="javascript:page_selectCity('city',1);"><custom:button type="3" label="L_Asterisk" imgsrc="flash.gif" border="0"/></a>
            	<custom:text property="cityname" name="countyareadetail" readonly="true" size="20"/>
            </td>
            <td class="need"><%= label.getLabelName("L_County") + label.getLabelName("L_Colon") %></td>
            <td>
            	<custom:text property="countycode" name="countyareadetail" size="10" readonly="true"/>
              	<a onclick="javascript:page_selectCity('county',2);"><custom:button type="3" label="L_Asterisk" imgsrc="flash.gif" border="0"/></a>
              	<custom:text property="countyname" name="countyareadetail" readonly="true" size="20"/>
            </td>
          </tr>
          
          <tr>
          
          <td class="need"><%= label.getLabelName("L_Status") + label.getLabelName("L_Colon") %></td>
            <td><custom:select optionsName="allstatus" optionValueKey="statusvalue" optionInnerTextKey="statusname" name="countyareadetail" label="L_StatusName" property="status"  command="notnull" defaultValueCost="41"/></td>
          
          	<td class="need"><%= label.getLabelName("L_Population") + label.getLabelName("L_Colon") %></td>
          	<td>
          		<custom:text property="population" name="countyareadetail" command="nonull" label="L_Population" />
            </td>
            </tr>
          <tr> 
            <td class="need"><%= label.getLabelName("L_Countyhospital") + label.getLabelName("L_Colon") %></td>
            <td><custom:text property="countyhospital" name="countyareadetail" command="nonull" label="L_Countyhospital" /></td>
            <td class="need"><%= label.getLabelName("L_Communityhealthcenter") + label.getLabelName("L_Colon") %></td>
            <td><custom:text property="communityhealthcenter" name="countyareadetail" command="nonull" label="L_Communityhealthcenter"/></td>
            </tr>
          <tr>
          	<td class="need"><%= label.getLabelName("L_Communitydoctor") + label.getLabelName("L_Colon") %></td>
            <td><custom:text property="communitydoctor" name="countyareadetail" command="nonull" label="L_Communitydoctor"/></td>
            <td class="need"><%= label.getLabelName("L_Agreementsaler") + label.getLabelName("L_Colon") %></td>
            <td><custom:text property="agreementsaler" name="countyareadetail" command="nonull" label="L_Agreementsaler"></custom:text></td>
          </tr>
          <tr> 
            <td class="need"><%= label.getLabelName("L_Expectcountylevel") + label.getLabelName("L_Colon") %></td>
            <td>
               <custom:selectdic dictType="ExpectCountyLevel" property="expectcountylevel" name="countyareadetail" command="notnull" defaultValue="----" defaultValueCost=""/>
            </td>
              <td class="td-text"><%= label.getLabelName("L_Nongoalhospital") + label.getLabelName("L_Colon") %></td>
            <td>
               <custom:text name="countyareadetail" property="nongoalhospital"/>
            </td>
          </tr>
          
            <tr> 
            <td class="td-text"><%= label.getLabelName("L_Nongoalclinic") + label.getLabelName("L_Colon") %></td>
            <td>
               <custom:text name="countyareadetail" property="nongoalclinic" />
            </td>
              <td class="td-text"><%= label.getLabelName("L_Nongoalpharmacy") + label.getLabelName("L_Colon") %></td>
            <td>
               <custom:text name="countyareadetail" property="nongoalpharmacy" />
            </td>
          </tr>
          
           <tr> 
            <td class="td-text"><%= label.getLabelName("L_Totalnongoal") + label.getLabelName("L_Colon") %></td>
            <td>
               <custom:text name="countyareadetail" property="totalnongoal"/>
            </td>
              <td class="td-text">&nbsp;</td>
            <td>
              &nbsp;
            </td>
          </tr>
          
          <tr> 
            <td class="td-text"><%= label.getLabelName("L_Comments") + label.getLabelName("L_Colon") %></td>
            <td colspan="3"> 
               <custom:text name="countyareadetail" property="comments" size="100"/>
            </td>
          </tr>
        </table>
      </td>
  </tr>
  <tr>
    <td class="summary_top"></td>
  </tr>
  <tr> 
      <td height="49" class="td_center">
      	<a onclick="page_done()"><custom:button type="1" label="L_Finish" imgsrc="finish.gif" border="0" style="width:60"/></a>
      	<!--  
      	<a onclick="page_back()"><custom:button type="1" label="L_Back" imgsrc="finish.gif" border="0" style="width:60"/></a>
     -->
      </td>
  </tr>
</form>
</table>

</body>
</html>